﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Eye.Open - Combinatorics</title>
	<link href="@Url.Content("~/Content/site.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/editor.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="Stylesheet" type="text/css" />
	<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
	
	<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
	<script src="@Url.Content("~/Scripts/jquery-ui-1.8.13.min.js")" type="text/javascript"></script>
	<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
	<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
	<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
</head>
<body>
	<script type="text/javascript">
		jQuery.validator.addMethod("CsvValidation", function (value, element, param) {
			var found = 0;
			var lastIsLetterOrDigit;

			for (var i = 0; i < value.length; i++) {
				var char = value[i];

				if (char == ',') {
					found++;
				}

				if (i == value.length - 1) {
					lastIsLetterOrDigit =
						((char >= "0" && char <= "9") ||
						(char >= "a" && char <= "z") ||
						(char >= "A" && char <= "Z"));
				}
			}

			var commaCorrect = found >= param.minimum - 1;

			return commaCorrect && lastIsLetterOrDigit;
		});

		jQuery.validator.unobtrusive.adapters.add(
			"csv", 
			["minimum"], 
			function (options) {
				var methodName = "CsvValidation";
				options.rules[methodName] = options.params;
				options.messages[methodName] = options.message;
			});  
	</script>
	<div class="page">
		<header>
			<div id="title">
			</div>
			<nav>
				<ul id="menu">
					<li><a>Home</a></li>
				</ul>
			</nav>
		</header>
		<section id="main">
			@RenderBody()
		</section>
		<footer>
		</footer>
	</div>
	<script type="text/javascript">
			alert(Enumerable.From("ciao").ToString("-"));
	</script>
</body>
</html>